package cm.day04;

import java.math.BigDecimal;

public class BigDecimalTest {
    public static void main(String[] args) {
        double[] arr={0.1,0.2,2.1,1,3.2,5.56,7.21};
        double count=0;
        for (int i = 0; i < arr.length; i++) {
            count+=i;
        }
       BigDecimal bdSum=new BigDecimal(String.valueOf(count));
        BigDecimal bdAverage=new BigDecimal(String.valueOf(arr.length));
        BigDecimal average=bdSum.divide(bdAverage,2,2);
        System.out.println("数组的平均值是:"+average);
    }
}
